<!-- For child view, display the label(s) as a link to the build summary -->
<td ng-if="::cdash.childview == 1" align="left" class="paddt" colspan="2">
  <a ng-href="build/{{::build.id}}">
    {{::build.label}}
  </a>

  <!-- Icon for build errors / test failing -->
  <a ng-if="::build.compilation.error > 0 || build.test.fail > 0" href=""
     ng-click="toggleBuildProblems(build)">
    <img src="img/Info.png" alt="info" class="icon"></img>
  </a>

  <!-- Link to notes specific to this subproject build -->
  <a title="View notes"
     name="notesLink"
     ng-if="::build.notes > 0"
     ng-href="build/{{::build.id}}/notes">
    <img src="img/document.png" alt="Notes" class="icon"/>
  </a>
</td>

<!-- Otherwise, show build name & site on the row. -->
<td ng-if="::cdash.childview != 1" align="left" class="paddt">
  <a ng-href="viewSite.php?siteid={{::build.siteid}}&project={{::cdash.projectid}}&currenttime={{::cdash.unixtimestamp}}">{{::build.site}}</a>
  <img ng-if="::build.siteoutoforder == 1" border="0" src="img/flag.png" title="flag"></img>
</td>

<td ng-if="::cdash.childview != 1" align="left">
  <div ng-if="::build.id && build.buildplatform.length > 0" style="float:left;">
    <img class="icon" alt="platform" ng-src="img/platform_{{::build.buildplatform}}.png"/>
  </div>

  <div ng-if="::build.id" style="float: left; margin: 0px 4px;">
    <a class="buildinfo" alt="generator"
       ng-if="::build.numchildren == 0"
       ng-href="build/{{::build.id}}">
      {{::build.buildname}}
    </a>
    <a class="buildinfo" alt="generator"
       ng-if="::build.numchildren > 0"
       ng-href="{{::build.multiplebuildshyperlink}}">
      {{::build.buildname}}
    </a>
  </div>

  <div ng-if="::!build.id" style="float: left; margin: 0px 4px;">{{::build.buildname}}</div>

  <div style="float:left;">
    <a title="View notes"
       name="notesLink"
       ng-if="::build.notes > 0"
       ng-href="build/{{::build.id}}/notes">
      <img src="img/document.png" alt="Notes" class="icon"/>
    </a>

    <a href="" style="float: left;"
       ng-if="::build.uploadfilecount > 0"
       ng-href="viewFiles.php?buildid={{::build.id}}"
       title="{{::build.uploadfilecount}} files uploaded with this build">
      <img src="img/package.png" alt="Files" class="icon"/>
    </a>

    <!-- If the build has errors or test failing -->
    <a href="" style="float: left;"
       ng-if="::build.compilation.error > 0 || build.test.fail > 0"
       ng-click="toggleBuildProblems(build)">
      <img src="img/Info.png" alt="info" class="icon"></img>
    </a>

    <!-- If the build is expected and missing -->
    <a href="" style="float: left;"
       ng-if="::build.expectedandmissing == 1"
       ng-click="toggleExpectedInfo(build)">
      <img src="img/Info.png" alt="info" class="icon"></img>
    </a>

    <!-- Display the note icon -->
    <a name="Build Notes" class="jTip" id="buildnote_{{::build.id}}"
       ng-if="::build.buildnotes > 0"
       ng-href="ajax/buildnote.php?buildid={{::build.id}}&width=350&link=build%2F{{::build.id}}">
      <img src="img/note.png" alt="note" class="icon"></img>
    </a>

    <div style="float: left;" ng-if="::cdash.user.admin == 1">
      <!-- Display folder icon to edit this build for administrative users -->
      <a href="" ng-click="toggleAdminOptions(build)">
        <img name="adminoptions" src="img/folder.png" class="icon"/>
      </a>
      <img src="img/loading.gif" ng-show="build.loading == 1"/>
    </div>
  </div>

  <!-- Problematic build history table -->
  <div ng-if="::build.compilation.error > 0 || build.test.fail > 0">
    <table width="100%" border="0" ng-if="build.showProblems" class="animate-show">
      <tbody>
        <tr ng-if="::build.hasErrors">
          <td bgcolor="#DDDDDD" id="nob">
            <font size="2">
              Build has been failing since
              <b>
                <a ng-href="index.php?project={{::cdash.projectname}}&date={{::build.failingDate}}">
                  {{::build.failingSince}}
                </a>
                (<ng-pluralize count="::build.daysWithErrors"
                              when="{'0':     'today',
                                     '1':     '{} day',
                                     'other': '{} days'}">
                </ng-pluralize>)
              </b>
            </font>
          </td>
        </tr>
        <tr ng-if="::build.hasFailingTests">
          <td bgcolor="#DDDDDD" id="nob">
            <font size="2">
              Tests have been failing since
              <b>
                <a ng-href="index.php?project={{::cdash.projectname}}&date={{::build.testsFailingDate}}">
                  {{::build.testsFailingSince}}
                </a>
                (<ng-pluralize count="::build.daysWithFailingTests"
                              when="{'0':     'today',
                                     '1':     '{} day',
                                     'other': '{} days'}">
                </ng-pluralize>)
              </b>
            </font>
          </td>
        </tr>
      </tbody>
    </table>
  </div>

  <!-- expected info table -->
  <div ng-if="::build.expectedandmissing == 1">
    <table width="100%" border="0" ng-if="build.showExpectedInfo" class="animate-show">
      <tbody>
        <tr>
          <td bgcolor="#DDDDDD" id="nob">
            <font size="2">
              <span ng-if="::build.lastSubmission == -1">
                This build has never submitted.
              </span>
              <span ng-if="::build.lastSubmission != -1">
                This build has not submitted since
                  <b>
                    <a ng-href="index.php?project={{::cdash.projectname}}&date={{::build.lastSubmissionDate}}">
                      {{::build.lastSubmission}}
                    </a>
                (<ng-pluralize count="::build.daysSinceLastBuild"
                              when="{'1':     '{} day',
                                     'other': '{} days'}">
                </ng-pluralize>)
              </span>
            </font>
          </td>
        </tr>
      </tbody>
    </table>
  </div>

  <!-- admin options table -->
  <div ng-if="::cdash.user.admin == 1">
    <div ng-if="build.showAdminOptions == 1">
      <table width="100%" border="0" class="animate-show">
        <!-- If user is admin of the project propose to group this build -->
        <tr ng-repeat="group in ::cdash.all_buildgroups">
          <td width="35%">
            <b>{{::group.name}}</b>:
          </td>
          <td ng-if="::group.name == buildgroup.name" colspan="2">
            <a ng-show="build.expected == 0" href="" ng-click="toggleExpected(build, group.id)">
              [mark as expected]
            </a>
            <a ng-show="build.expected == 1 || build.expectedandmissing == 1" href="" ng-click="toggleExpected(build, group.id)">
              [mark as non expected]
            </a>
          </td>
          <td ng-if="::group.name != buildgroup.name" colspan="2">
            <input type="checkbox" ng-model="build.expected" ng-true-value="'1'" ng-false-value="'0'"> expected</input>
          </td>
          <td ng-if="::group.name != buildgroup.name" class="nob">
            <a href="" ng-click="moveToGroup(build, group.id)"> [move to group] </a>
          </td>
        </tr>
        <tr>
          <td colspan="3" class="nob">
            <a href="" ng-click="showModal(build)"> [remove this build] </a>
          </td>
        </tr>
      </table>

      <div tooltip-popup-delay="1500"
           tooltip-append-to-body="true"
           uib-tooltip="Done builds will be overwritten if a new one is submitted with the same site, build name, and timestamp."
      >
        <a ng-show="build.done == 0" href="" ng-click="toggleDone(build)">
          [mark as done]
        </a>
        <a ng-show="build.done == 1" href="" ng-click="toggleDone(build)">
          [mark as not done]
        </a>
      </div>
    </div>
  </div>

  <!-- changeid link/icon -->
  <div ng-if="::build.changelink">
    <a target="_blank" ng-href="{{::build.changelink}}">
      <img class="smallicon" ng-src="{{::build.changeicon}}"/>
    </a>
  </div>

</td>

<td ng-if="::buildgroup.hasupdatedata" align="center"
    ng-class="::!build.hasupdate ? '' : (
                build.update.errors == 1 ? 'error': (
                build.update.warning == 1 ? 'warning' : 'normal'))">
  <div ng-if="::build.hasupdate">
    <img ng-if="::build.userupdates > 0" src="img/yellowled.png" height="10px" alt="star" title="I checked in some code for this build!"/>
    <a ng-href="viewUpdate.php?buildid={{::build.id}}">
      {{::build.update.files}}
    </a>
  </div>
</td>

<td ng-if="::buildgroup.hasupdatedata && cdash.advancedview != 0 && cdash.showstarttime"
    align="center">
  <div ng-if="::build.hasupdate">
    {{::build.update.time}}
  </div>
</td>

<td ng-if="::buildgroup.hasconfiguredata" align="center" ng-class="::{'error': build.configure.error > 0, 'normal': build.configure.error == 0}">
  <div ng-if="::build.hasconfigure">
    <a ng-href="build/{{::build.id}}/configure">
      {{::build.configure.error}}
    </a>
  </div>
</td>

<td ng-if="::buildgroup.hasconfiguredata" align="center" ng-class="::{'warning': build.configure.warning > 0, 'normal': build.configure.warning == 0}">
  <div ng-if="::build.hasconfigure">
    <a ng-href="build/{{::build.id}}/configure">
      {{::build.configure.warning}}
    </a>
    <sub ng-if="::build.configure.warningdiff > 0">+{{::build.configure.warningdiff}}</sub>
    <sub ng-if="::build.configure.warningdiff < 0">{{::build.configure.warningdiff}}</sub>
  </div>
</td>

<td ng-if="::buildgroup.hasconfiguredata && cdash.advancedview != 0 && cdash.showstarttime"
    align="center">
  <div ng-if="::build.hasconfigure">
    {{::build.configure.time}}
  </div>
</td>

<td ng-if="::buildgroup.hascompilationdata" align="center" ng-class="::{'error': build.compilation.error > 0, 'normal': build.compilation.error == 0}">
  <div ng-if="::build.hascompilation"
       ng-class="::{'valuewithsub': build.compilation.nerrordiffp > 0 || build.compilation.nerrordiffn > 0}">
    <a ng-href="viewBuildError.php?buildid={{::build.id}}">
      {{::build.compilation.error}}
    </a>
    <a ng-if="::build.compilation.nerrordiffp > 0" class="sup" ng-href="viewBuildError.php?onlydeltap&buildid={{::build.id}}">
      +{{::build.compilation.nerrordiffp}}
    </a>

    <a ng-if="::build.compilation.nerrordiffn > 0" ng-href="viewBuildError.php?onlydeltan&buildid={{::build.id}}">
      <span class="sub">-{{::build.compilation.nerrordiffn}}</span>
    </a>
  </div>
</td>

<td ng-if="::buildgroup.hascompilationdata" align="center" ng-class="::{'warning': build.compilation.warning > 0, 'normal': build.compilation.warning == 0}">
  <div ng-if="::build.hascompilation"
       ng-class="::{'valuewithsub': build.compilation.nwarningdiffp > 0 || build.compilation.nwarningdiffn > 0}">
    <a ng-href="viewBuildError.php?type=1&buildid={{::build.id}}">
      {{::build.compilation.warning}}
    </a>

    <a ng-if="::build.compilation.nwarningdiffp > 0" class="sup" ng-href="viewBuildError.php?type=1&onlydeltap&buildid={{::build.id}}">
      +{{::build.compilation.nwarningdiffp}}
    </a>
    <a ng-if="::build.compilation.nwarningdiffn > 0" ng-href="viewBuildError.php?type=1&onlydeltan&buildid={{::build.id}}">
      <span class="sub">-{{::build.compilation.nwarningdiffn}}</span>
    </a>
  </div>
</td>

<td ng-if="::buildgroup.hascompilationdata && cdash.advancedview != 0 && cdash.showstarttime"
    align="center">
  <div ng-if="::build.hascompilation">
    {{::build.compilation.time}}
  </div>
</td>

<td ng-if="::buildgroup.hastestdata" align="center" ng-class="::{'warning': build.test.notrun > 0, 'normal': build.test.notrun == 0}">
  <div ng-if="::build.hastest"
       ng-class="::{'valuewithsub': build.test.nnotrundiffp > 0 || build.test.nnotrundiffn > 0}">
    <a ng-href="viewTest.php?onlynotrun&buildid={{::build.id}}{{::cdash.testfilters}}{{::cdash.extrafilterurl}}">
      {{::build.test.notrun}}
    </a>
    <a ng-if="::build.test.nnotrundiffp > 0" class="sup" ng-href="viewTest.php?onlydelta&buildid={{::build.id}}{{::cdash.testfilters}}{{::cdash.extrafilterurl}}">
      +{{::build.test.nnotrundiffp}}
    </a>
    <span ng-if="::build.test.nnotrundiffn > 0" class="sub">-{{::build.test.nnotrundiffn}}</span>
  </div>
</td>

<td ng-if="::buildgroup.hastestdata" align="center" ng-class="::{'error': build.test.fail > 0, 'normal': build.test.fail < 1}">
  <div ng-if="::build.hastest"
       ng-class="::{'valuewithsub': build.test.nfaildiffp > 0 || build.test.nfaildiffn > 0}">
    <a ng-href="viewTest.php?onlyfailed&buildid={{::build.id}}{{::cdash.testfilters}}{{::cdash.extrafilterurl}}">
      {{::build.test.fail}}
    </a>
    <a ng-if="::build.test.nfaildiffp > 0" class="sup" ng-href="viewTest.php?onlydelta&buildid={{::build.id}}{{::cdash.testfilters}}{{::cdash.extrafilterurl}}">
      +{{::build.test.nfaildiffp}}
    </a>
    <span ng-if="::build.test.nfaildiffn > 0" class="sub">
      -{{::build.test.nfaildiffn}}
    </span>
  </div>
</td>

<td ng-if="::buildgroup.hastestdata" align="center" ng-class="::{'normal': build.test.pass > -1}">
  <div ng-if="::build.hastest"
       ng-class="::{'valuewithsub': build.test.npassdiffp > 0 || build.test.npassdiffn > 0}">
    <a ng-href="viewTest.php?onlypassed&buildid={{::build.id}}{{::cdash.testfilters}}{{::cdash.extrafilterurl}}">
      {{::build.test.pass}}
    </a>
    <a ng-if="::build.test.npassdiffp > 0" class="sup" ng-href="viewTest.php?onlydelta&buildid={{::build.id}}{{::cdash.testfilters}}{{::cdash.extrafilterurl}}">
      +{{::build.test.npassdiffp}}
    </a>

    <span ng-if="::build.test.npassdiffn > 0" class="sub">
      -{{::build.test.npassdiffn}}
    </span>
  </div>
</td>

<td align="center"
    ng-if="::buildgroup.hastestdata && cdash.showtesttime"
    ng-class="::{'error': build.test.timestatus > 0, 'normal': build.test.timestatus == 0}">
  <div ng-if="::build.hastest"
       ng-class="::{'valuewithsub': build.build.test.ntimediffp > 0 || build.test.ntimediffn > 0}">
    <div ng-if="::build.test.timestatus > 0">
      <a ng-href="viewTest.php?onlytimestatus&buildid={{::build.id}}{{::cdash.testfilters}}{{::cdash.extrafilterurl}}">
        {{::build.test.timestatus}}
      </a>
      <a ng-if="::build.test.ntimediffp > 0" class="sup" ng-href="viewTest.php?onlydelta&buildid={{::build.id}}{{::cdash.testfilters}}{{::cdash.extrafilterurl}}">
        +{{::build.test.ntimediffp}}
      </a>
      <span ng-if="::build.test.ntimediffn > 0" class="sub">
        -{{::build.test.ntimediffn}}
      </span>
    </div>

    <span ng-if="::build.test.timestatus">
      {{::build.test.time}}
      <a ng-if="::build.test.ntimediffp > 0" class="sup" ng-href="viewTest.php?onlydelta&buildid={{::buildid}}{{::cdash.testfilters}}{{::cdash.extrafilterurl}}">
        +{{::build.test.ntimediffp}}
      </a>
      <span ng-if="::build.test.ntimediffn > 0" class="sub">
        -{{::build.test.ntimediffn}}
      </span>
    </span>

    <span ng-if="::!build.test.timestatus">
      {{::build.test.time}}
    </span>
  </div>
</td>

<td align="center"
    ng-if="::buildgroup.hastestdata && cdash.advancedview != 0 && cdash.showProcTime">
  {{::build.test.procTime}}
</td>

<td align="center" ng-if="::cdash.showstarttime">
  <span ng-if="::!build.builddate" class="builddateelapsed" alt="Expected submit time: {{::build.expectedstarttime}}">
    Expected build
  </span>

  <div ng-if="::build.builddate">
    <span class="builddateelapsed" title="{{::build.timesummary}}">
      {{::build.builddateelapsed}}
    </span>
  </div>
</td>

<td align="center" ng-if="::cdash.showorder">
  {{::build.position}}
</td>

<!-- display the labels -->
<td ng-if="::cdash.childview != 1 && cdash.displaylabels == 1" class="nob" align="left">
  {{::build.label}}
</td>
